let db = {
  save (key, value) {  //写入本地存储
    localStorage.setItem(key, JSON.stringify(value))
  },
  
  get (key, defaultValue = {}) {  //从本地存储读出
    return JSON.parse(localStorage.getItem(key)) || defaultValue
  },
  
  remove (key) {  //删除
    localStorage.removeItem(key)
  },
  
  clear () { //删除全部
    localStorage.clear()
  }
}
 
export default db